package com.aiwhose.aiwhosecore.bean.plublicaiwhose.bean;

import lombok.Data;

import java.util.List;

/**
 * @author Administrator
 */
@Data
public class CustomMessageBean {

    // 内部类：文本消息
    @Data
    public static class TextMessage {
        private String touser;
        private String msgtype;
        private Text text;

        public TextMessage(String touser, String content) {
            this.touser = touser;
            this.msgtype = "text";
            this.text = new Text(content);
        }

        @Data
        private static class Text {
            private String content;

            public Text(String content) {
                this.content = content;
            }
        }
    }

    // 内部类：图片消息
    @Data
    public static class ImageMessage {
        private String touser;
        private String msgtype;
        private Image image;

        public ImageMessage(String touser, String mediaId) {
            this.touser = touser;
            this.msgtype = "image";
            this.image = new Image(mediaId);
        }

        @Data
        private static class Image {
            private String media_id;

            public Image(String mediaId) {
                this.media_id = mediaId;
            }
        }
    }

    // 其他消息类型的类似定义，如语音消息、视频消息、音乐消息、图文消息等...

    // 示例内部类：菜单消息
    public static class MenuMessage {
        private String touser;
        private String msgtype;
        private MsgMenu msgmenu;

        public MenuMessage(String touser, String headContent, List<MenuItem> list, String tailContent) {
            this.touser = touser;
            this.msgtype = "msgmenu";
            this.msgmenu = new MsgMenu(headContent, list, tailContent);
        }

        @Data
        private static class MsgMenu {
            private String head_content;
            private List<MenuItem> list;
            private String tail_content;

            public MsgMenu(String headContent, List<MenuItem> list, String tailContent) {
                this.head_content = headContent;
                this.list = list;
                this.tail_content = tailContent;
            }
        }

        @Data
        private static class MenuItem {
            private String id;
            private String content;

            public MenuItem(String id, String content) {
                this.id = id;
                this.content = content;
            }
        }
    }

    @Data
    public static class TextImageMessage {
        private String touser; // 接收消息的用户openid
        private String msgtype; // 消息类型，此处固定为news
        private News news; // News 类对象，包含图文消息内容

        // News 内部类，表示图文消息内容
        @Data
        public static class News {
            private List<Article> articles; // 图文消息列表

            // Article 内部类，表示图文消息中的文章
            @Data
            public static class Article {
                private String title; // 图文消息标题
                private String description; // 图文消息描述
                private String url; // 点击跳转的链接
                private String picurl; // 图片链接
            }
        }

        // NewsMessage 类的构造方法
        public TextImageMessage(String touser, News news) {
            this.touser = touser;
            this.msgtype = "news";
            this.news = news;
        }
    }

}
